﻿CREATE TABLE [account].[CostControl] (
    [AccountUId]                  INT                 NOT NULL,
    [AccountId]                   SMALLINT            NOT NULL,
    [AccountCode]                 VARCHAR (8)         NOT NULL,
    [AccountName]                 VARCHAR (100)       NOT NULL,
    [AccountType]                 CHAR (1)            NOT NULL,
    [AccountCateryCode]           CHAR (3)            NOT NULL,
    [AccountCateryName]           VARCHAR (50)        NOT NULL,
    [AccountMappingPath]          [sys].[hierarchyid] NOT NULL,
    [AccountMappingLevel]         BIGINT              NOT NULL,
    [AccountMappingStartDate]     DATE                NOT NULL,
    [AccountMappingEndDate]       DATE                NOT NULL,
    [AccountOrderBy]              INT                 NOT NULL,
    [IsLatest]                    BIT                 NOT NULL,
    [IsActive]                    BIT                 NOT NULL,
    [IsInternal]                  BIT                 NOT NULL,
    [TotalCostDetailUId]          INT                 NOT NULL,
    [TotalCostDetailId]           SMALLINT            NOT NULL,
    [TotalCostDetailCode]         VARCHAR (8)         NULL,
    [TotalCostDetailName]         VARCHAR (100)       NULL,
    [TotalCostDetailOrderBy]      INT                 NOT NULL,
    [ExpenseTypeUId]              INT                 NULL,
    [ExpenseTypeId]               SMALLINT            NULL,
    [ExpenseTypeCode]             VARCHAR (8)         NULL,
    [ExpenseTypeName]             VARCHAR (100)       NULL,
    [ExpenseTypeOrderBy]          INT                 NULL,
    [ExpenseTypeDetailUId]        INT                 NULL,
    [ExpenseTypeDetailId]         SMALLINT            NULL,
    [ExpenseTypeDetailCode]       VARCHAR (8)         NULL,
    [ExpenseTypeDetailName]       VARCHAR (100)       NULL,
    [ExpenseTypeDetailOrderBy]    INT                 NULL,
    [ExpenseDetailUId]            INT                 NULL,
    [ExpenseDetailId]             SMALLINT            NULL,
    [ExpenseDetailCode]           VARCHAR (8)         NULL,
    [ExpenseDetailName]           VARCHAR (100)       NULL,
    [ExpenseDetailOrderBy]        INT                 NULL,
    [FinanceExpenseDetailUId]     INT                 NULL,
    [FinanceExpenseDetailId]      SMALLINT            NULL,
    [FinanceExpenseDetailCode]    VARCHAR (8)         NULL,
    [FinanceExpenseDetailName]    VARCHAR (100)       NULL,
    [FinanceExpenseDetailOrderBy] INT                 NULL,
    [ProjectExpenseDetailUId]     INT                 NULL,
    [ProjectExpenseDetailId]      SMALLINT            NULL,
    [ProjectExpenseDetailCode]    VARCHAR (8)         NULL,
    [ProjectExpenseDetailName]    VARCHAR (100)       NULL,
    [ProjectExpenseDetailOrderBy] INT                 NULL,
    [SubAccountUId]               INT                 NULL,
    [SubAccountId]                SMALLINT            NULL,
    [SubAccountCode]              VARCHAR (8)         NULL,
    [SubAccountName]              VARCHAR (100)       NULL,
    [SubAccountOrderBy]           INT                 NULL,
    PRIMARY KEY CLUSTERED ([AccountUId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF)
);

